index.html.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <!-- 资讯列表 -->
  23. <div class="newsDetail">
  24. <div class="inner">
  25. <div class="innerDetail">
  26. <div class="headImg"></div>
  27. <div class="innerDetail1">
  28. <div class="leftBottom" v-html="newsDetail.content"></div>
  29. </div>
  30. <div class="footImg"></div>
  31. </div>
  32. <div class="innerLeft">
  33. <ul>
  34. <li>
  35. 导航列表
  36. </li>
  37. <li v-for="(item, index) in bottomMenu" :key="index">
  38. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  39. v-if="item.id == pageId && item.id != 7" class="active">
  40. {{ item.name }}
  41. </NuxtLink>
  42. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  43. v-else-if="item.id != pageId && item.id != 7">
  44. {{ item.name }}
  45. </NuxtLink>
  46. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name"
  47. v-if="item.id == 7 && pageId == 7 && routeHref == '/specialList/7'" class="active">
  48. {{item.name }}
  49. </NuxtLink>
  50. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name" v-else-if="item.id == 7">
  51. {{ item.name}}
  52. </NuxtLink>
  53. </li>
  54. </ul>
  55. </div>
  56. <div style="clear: both;"></div>
  57. </div>
  58. </div>
  59. <!-- 广告二 -->
  60. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  61. <!-- 页面底部 -->
  62. <HomeFoot1></HomeFoot1>
  63. </template>
  64. <script setup>
  65. //1.页面依赖 start ---------------------------------------->
  66. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  67. import { ArrowRight } from '@element-plus/icons-vue'
  68. import { ref, onMounted } from 'vue';
  69. //获得跳转过来的id
  70. const route = useRoute();
  71. //获得当前的完整路径
  72. const fullPath = route.path;
  73. //拆分,取出来中间这一段,然后提取数字部分
  74. const segments = fullPath.split('/');
  75. const targetSegment = segments[2];
  76. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  77. let articleId;
  78. let pageId;
  79. //通过导航路径反向查询导航id
  80. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  81. method: 'GET',
  82. query: {
  83. 'foot_pinyin': targetSegment,
  84. },
  85. });
  86. if(getRouteId.code == 200){
  87. articleId = getRouteId.data.id;
  88. pageId = getRouteId.data.id;
  89. }else{
  90. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  91. console.log("错误位置:通过url路径查询导航池id")
  92. console.log("后端错误反馈:",getRouteId.message)
  93. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  94. }
  95. //1.页面依赖 end ---------------------------------------->
  96. //2.页面数据 start ---------------------------------------->
  97. //广告列表
  98. const adList = ref([]);
  99. let adImg1 = ref([]);
  100. let adImg2 = ref([]);
  101. const newsDetail = ref({})
  102. const bottomMenu = ref([]);
  103. async function getPageData() {
  104. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  105. method: 'GET',
  106. query: {
  107. 'fcat_id': articleId,
  108. 'type':0
  109. },
  110. });
  111. newsDetail.value = mkdata.data;
  112. }
  113. getPageData();
  114. async function getPageMenu() {
  115. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  116. method: 'GET',
  117. query: {},
  118. });
  119. bottomMenu.value = mkdata.data;
  120. }
  121. getPageMenu();
  122. //2.页面数据 end ---------------------------------------->
  123. //4.设置seo信息 start---------------------------------------->
  124. //4.1 设置seo信息
  125. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  126. method: 'GET',
  127. query: {},
  128. });
  129. let seoTitle = setData.data.website_head.title;
  130. let seoDescription = setData.data.website_head.description;
  131. let seoKeywords = setData.data.website_head.keywords;
  132. let seoSuffix = setData.data.website_head.suffix;
  133. let seoName = setData.data.website_head.website_name;
  134. useSeoMeta({
  135. title: seoTitle + "_" + seoSuffix,
  136. meta: [
  137. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  138. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 }
  139. ]
  140. });
  141. //4.设置seo信息 end---------------------------------------->
  142. onMounted(async () => {
  143. //从客户端获取行政职能部门 加快打开速度
  144. const { $webUrl, $CwebUrl } = useNuxtApp();
  145. //广告1
  146. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snscw_page_0001`
  147. const responseAd1 = await fetch(url, {
  148. headers: {
  149. 'Content-Type': 'application/json',
  150. 'Userurl': $CwebUrl,
  151. 'Origin': $CwebUrl
  152. }
  153. });
  154. const resultAd1 = await responseAd1.json();
  155. adImg1.value = resultAd1.data[0];
  156. //广告2
  157. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snscw_page_0002`
  158. const responseAd2 = await fetch(url2, {
  159. headers: {
  160. 'Content-Type': 'application/json',
  161. 'Userurl': $CwebUrl,
  162. 'Origin': $CwebUrl
  163. }
  164. });
  165. const resultAd2 = await responseAd2.json();
  166. adImg2.value = resultAd2.data[0];
  167. })
  168. </script>
  169. <style lang="less" scoped>
  170. @import '@/assets/css/about.less';
  171. </style>